package com.ai.entity;

import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BasePage<T> extends Page<T> {

    @ApiModelProperty(value = "开始时间")
    private String datebegin;

    @ApiModelProperty(value = "结束时间")
    private String dateend;

    public QueryWrapper<T> getQuery(QueryWrapper<T> queryWrapper) {
        return queryWrapper.ge((!StringUtils.isEmpty(getDatebegin())), "create_time", getDatebegin())
                .lt((!StringUtils.isEmpty(getDateend())), "create_time", getDateend());
    }
}
